# -*- coding: utf-8 -*-
"""
@Version : 
@Author  : ChenMZ
@Time    : 2025/09/16
@File    : __init__.py.py
@Desc    :
@Modify  : 
"""
import sys
import enum
from typing import Dict, Union, List
from device import dev_interface
from device._dev_model import Dev


class DevGroups(enum.Enum):
    CPU = "CPU"
    GPUs = "GPUs"
    ETHs = "ETHs"

    def __init__(self, dev_name: str):
        self._dev = dev_name

    @property
    def group_name(self):
        return self._dev

    @property
    def dev_client(self):
        if self._dev.endswith("s"):
            try:
                return getattr(dev_interface, self._dev)().get_dev()
            except AttributeError:
                return []
        else:
            return [getattr(dev_interface, self._dev)()]

    @classmethod
    def members(cls) -> Dict[str, 'DevGroups']:
        return cls.__members__
